package org.example.leetcode;

/**
 * @version 1.0.0
 * @author: lynn
 * @description: 装最多水的问题
 * @date: 2021/7/25 8:47
 */
public class LC11 {
    public static void main(String[] args) {
        LC11 lc=new LC11();
        int[] height={4,3,2,1,4};
        System.out.println(lc.maxArea(height));
    }


    public int maxArea(int[] height) {
        if (height.length<=1||height==null) return 0;
        int l=0;
        int r=height.length-1;
        int area=0;
        while(l<r){
            int tmp=Math.min(height[r],height[l])*(r-l);
            area=Math.max(area,tmp);
            int val= height[l]<height[r]?(l++):(r--);

        }
        return area;
    }

}
